package besuper;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "besuper")
@XmlAccessorType(XmlAccessType.FIELD)
public class BeSuper {
	@XmlElementWrapper(name = "users")
	@XmlElement(name = "user")
	private List<User> users;
	@XmlElementWrapper(name = "questions")
	@XmlElement(name = "question")
	private List<Question> questions;
	@XmlElementWrapper(name = "answers")
	@XmlElement(name = "answer")
	private List<Answer> answers;
	
	public BeSuper(){
		users=new ArrayList<User>();
		questions=new ArrayList<Question>();
		answers=new ArrayList<Answer>();
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public List<Question> getQuestions() {
		return questions;
	}

	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}

	public List<Answer> getAnswers() {
		return answers;
	}

	public void setAnswers(List<Answer> answers) {
		this.answers = answers;
	}
}
@XmlAccessorType(XmlAccessType.FIELD)
class User {
	@XmlElement(name="name")
	private String name;
	@XmlElement(name="score")
	private int score;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	@Override
	public String toString() {
		return "User [name=" + name + ", score=" + score + "]";
	}
}
@XmlAccessorType(XmlAccessType.FIELD)
class Question {
	@XmlElement(name="id")
	private String id;
	@XmlElement(name="from")
	private String from;
	@XmlElement(name="sloved")
	private boolean sloved;
	@XmlElement(name="context")
	private String context;

	public String getId() {
		return id;
	}

	public void setId(String string) {
		this.id = string;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public boolean isSloved() {
		return sloved;
	}

	public void setSolved(boolean solved) {
		this.sloved = solved;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

	public String toString() {
		return "Question [id=" + id + ", from=" + from + ", sloved=" + sloved + "]" + context;
	}
}
@XmlAccessorType(XmlAccessType.FIELD)
class Answer {
	@XmlElement(name ="id")
	private String id;
	@XmlElement(name ="from")
	private String from;
	@XmlElement(name ="context")
	private String context;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

	@Override
	public String toString() {
		return "Answer [id=" + id + ", from=" + from + "]" + context;
	}
}